<!DOCTYPE html>
<html>
<head>
<title>第三方应用添加</title>
<meta name="content-type" content="text/html; charset=UTF-8">
<div th:replace="/pub.html"></div>
<script type="text/javascript">
var useradd_submitForm = function(dialog, user_datagrid, p) {
	if ($('#user_addForm').form('validate')) {
		$.post('/oauth2/client/add', $("#user_addForm").serialize(), function(j) {
			if (j.success) {
				user_datagrid.datagrid('reload');
				dialog.dialog('destroy');
			}
			p.messager.show({
				title : '提示',
				msg : j.msg,
				timeout : 5000,
				showType : 'slide'
			});
		}, 'json').error(function() {
			$.messager.show({
				title : '提示',
				msg : '你的权限不够',
				timeout : 5000,
				showType : 'slide'
			});
		});
	}
};
</script>
</head>

<body>
	<form id="user_addForm" method="post">
		<table style="width: 100%;" class="table table-hover table-condensed">
			<tr>
				<th>appKey(client_id)</th>
				<td><input name="clientId" class="easyui-validatebox" data-options="required:true,missingMessage:'appKey必填'" /></td>
				<th>资源id集合</th>
				<td><input name="resourceIds"/></td>
			</tr>
			<tr>
				<th>访问密匙</th>
				<td><input type="password" name="clientSecret" class="easyui-validatebox" data-options="required:true,missingMessage:'访问密匙必填'" /></td>
				<th>权限范围</th>
				<td><input name="scope" class="easyui-validatebox" data-options="required:true,missingMessage:'必填(read,write,trust)'" /></td>
			</tr>
			<tr>
				<th>授权模式</th>
				<td><input name="authorizedGrantTypes" class="easyui-validatebox" data-options="required:true,missingMessage:'必填(authorization_code,password,refresh_token,implicit,client_credentials)'" /></td>
				<th>重定向URI</th>
				<td><input name="webServerRedirectUri"/></td>
			</tr>
			<tr>
				<th>权限</th>
				<td><input name="authorities"/></td>
				<th>令牌时效</th>
				<td><input name="accessTokenValidity"></td>
			</tr>
			<tr>
				<th>刷新时效</th>
				<td><input name="refreshTokenValidity"/></td>
				<th>自动放行</th>
				<td>
				    <div class="easyui-radio" id="radio_autoapprove">
							<input type="radio" name="autoapprove" value="true" checked label="是">
							<input type="radio" name="autoapprove" value="false" label="否">
						</div>
				</td>
			</tr>
			<tr>
				<th>权限</th>
				<td><input name="authorities"/></td>
				<th>令牌时效</th>
				<td><input name="accessTokenValidity"></td>
			</tr>
		</table>
	</form>
</body>
</html>